<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="MvcContrib.UI.Grid"%>
<%@ Import Namespace="etcetera.Mvc.UI.Toolbar"%>
<%@ Import Namespace="Samples.Models"%>
<%@ Import Namespace="etcetera.Mvc.UI.Grid"%>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Grid and Pager Toolbar Demo</h2>
    
    <%= Html.GridEx<Actor>("Actors")
            .Titled("Actors")
            .WithId("Act")
            .Columns(col =>
                         {
                             col.For(x => Html.ActionLink(x.Id.ToString(), "Actor", new { Id = x.Id })).DoNotEncode().Named("Id");
                             col.For(x => x.FirstName).Sortable(false);
                             col.For(x => x.LastName).Sortable(true);
                         })
    %>
    
    <%= Html.PagerToolStrip("Actors")            
            .AjaxUrl(Url.Action("Actors", "Grid"))
            .AddToolbar(new Toolbar().AddButton("Add new Actor", Url.Action("New", "Grid"), "tBtnA"))
            .AddToolbar(new Toolbar().AddPageSizeSelect(10, 20, 50, 100))
            .AddToolbar(new Toolbar().AddNavButton(NavButton.First)
                                     .AddNavButton(NavButton.Previous))
            .AddToolbar(new Toolbar().AddPageInput())
            .AddToolbar(new Toolbar().AddNavButton(NavButton.Next)
                                     .AddNavButton(NavButton.Last))
            .AddToolbar(new Toolbar().AddPageStatus())
            .AddToolbar(new Toolbar().AddRefreshButton("Refresh Actors"))
            .AddToolbar(new Toolbar().AddButton("Export all Actors to Excel", Url.Action("ActorsExcel"), "tBtnXls"))
            .WithId("pgrC")
            .WithGridId("Act")
            .Format("Showing {0} to {1} of {2} actors")
            .SinglePageFormat("Showing {0} of {2} actors")
            .KeepPageSize()
            .ColModel(col =>
                        {
                            col.For("id", "Grid/Actor/{0}", "id");
                            col.For("firstname");
                            col.For("lastname");
                        })
    %>

</asp:Content>
